|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.ObjectAnimal
public abstract class Animal
A class representing shared characteristics of animals.
| Constructor Summary | |
|---|---|
Animal(Field field,
Location location)
Create a new animal at location in field. |
|
| Method Summary | |
|---|---|
abstract void |
act(List<Animal> newAnimals)
Make this animal act - that is: make it do whatever it wants/needs to do. |
protected Field |
getField()
Return the animal's field. |
protected Location |
getLocation()
Return the animal's location. |
protected boolean |
isAlive()
Check whether the animal is alive or not. |
protected void |
setDead()
Indicate that the animal is no longer alive. |
protected void |
setLocation(Location newLocation)
Place the animal at the new location in the given field. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Animal(Field field,
Location location)
field - The field currently occupied.location - The location within the field.| Method Detail |
|---|
public abstract void act(List<Animal> newAnimals)
newAnimals - A list to receive newly born animals.protected Field getField()
protected Location getLocation()
protected boolean isAlive()
protected void setDead()
protected void setLocation(Location newLocation)
newLocation - The animal's new location.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||